﻿using System.ComponentModel.Composition;
using System.Waf.Applications;
using System.Windows.Navigation;
using System.Windows.Controls;
using System.Windows.Input;
using BesAsm.Stormwater.Swmm5ResultsUi.Presentation.Views;
using BesAsm.Stormwater.Swmm5ResultsUi.Applications.Views;

namespace BesAsm.Stormwater.Swmm5ResultsUi.Applications.ViewModels
{
  [Export]
  internal class ShellViewModel : ViewModel<IShellView>
  {
    private readonly DelegateCommand exitCommand;
    private readonly DelegateCommand openCommand;
    private readonly DelegateCommand timeSeriesToolCommand;

    [ImportingConstructor]
    public ShellViewModel(IShellView view)
      : base(view)
    {
      exitCommand = new DelegateCommand(Close);
      openCommand = new DelegateCommand(Open);
      timeSeriesToolCommand = new DelegateCommand(TimeSeriesTool);
    }

    public string Title { get { return ApplicationInfo.ProductName; } }

    public ICommand ExitCommand { get { return exitCommand; } }
    public ICommand OpenCommand { get { return openCommand; } }
    public ICommand TimeSeriesToolCommand { get { return timeSeriesToolCommand; } }

    public void Show()
    {
      ViewCore.Show();
    }

    private void Close()
    {
      ViewCore.Close();
    }

    private void Open()
    {
      ViewCore.Open();
    }

    private void TimeSeriesTool()
    {
      ViewCore.OpenTimeSeriesTool();      
    }
  }
}
